package com.egobuy.search.service.impl;

import com.egobuy.entity.Item;
import com.egobuy.pojo.BuyResult;
import com.egobuy.pojo.EgoBuyPager;
import com.egobuy.search.dao.SearchDAO;
import com.egobuy.search.service.SearchService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class SearchServiceImpl implements SearchService {
    @Autowired
    private SearchDAO searchDAO;


    @Override
    public BuyResult<EgoBuyPager<Item>> search(String keyword, int page, int size) {
        return BuyResult.ok(searchDAO.search(keyword,page,size));
    }

    @Override
    public BuyResult save(Item item) {
        searchDAO.insertOrUpdate(item);
        return BuyResult.ok();
    }
}
